package cn.kickegg.concurrent.locks;

public class Sync03 implements  Runnable{
   static int i=0;
    @Override
    public void run() {
        for (int j=0;j<100000;j++){
           synchronized (Sync03.class) {
               i++;
           }

        }
    }
    public static void main(String[] args) throws InterruptedException {

            Thread thread1=new Thread(new Sync03());
            Thread thread2=new Thread(new Sync03());
            thread1.start();
            thread2.start();
            thread1.join();thread2.join();
            System.out.println(i);


    }



}
